﻿@{
    ViewBag.Title = "messageXX";
    Layout = "~/Views/Shared/Template.cshtml";
}

@using Partner.MVC.Models;
@{
    var user = Session["LoginUser"] as User_Info;
}

<div style="height: 300px;width: 100%;background:url(/static/hbweb/images/me.jpg);">
    <div class="container">
        <div class="header-message">
            <img class="fl" src="http://pic.huobanchina.com/o_1bp7omfg8e821pc4bbg1u8g1ifl9.jpeg" alt="" />
            <div class="fl header-text">
                <h3 class="user-name">@user.Use_Name </h3>
                <i class="icon-fabu3 point user-namei"></i>
            </div>
            <a id="AlterPwd" style="width:85px;" data-toggle="modal" data-target="#myModal" class="fr fn-font-hover-blue change change-password">
                修改密码
            </a>
        </div>
    </div>
</div>

<input type="hidden" value="@Model.M_Content" id="HouseId" />

<div class="bgcSil">
    <div class="container">
        <div class="mt30" style="width: 100%">
            <ul id="divLeft" style="width:24%" class="nav navbar-nav"></ul>
            <div id="divContent" style="width:75%;" class="fr mb80 cont bgcWhit news-list-con">
                <div class="bgcWhit neirong">
                    <div style="height:50px;">
                        <h3 style="float:left;padding:0 20px;" class="title">系统消息</h3><input style="float:left; margin:10px 20px;" type="button" onclick="location.href='/UserCenter/message'" class="btn ui-button-text-icon-primary" value="返回" />
                    </div>
                    <div class="fb_box">
                        <table class="table">
                            <tr>
                                <td><span class="c-red"></span></td>
                                <td>@Model.M_Title</td>
                            </tr>
                            <tr>
                                <td><span></span></td>
                                @if (@Model.M_Title != "房源推送")
                                {
                                <td>
                                    @Model.M_Content
                                </td>
                                }
                                else
                                {
                                <td>已为您找到以下的房源</td>
                                }
                            </tr>
                            <tbody id="tbo"></tbody>
                            <tr>
                                <td><span></span></td>
                                <td>@Model.M_Time</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    //循环   获取内容中的房源信息的ID
    $(function () {
        var str = $("#HouseId").val();
        var s = str.split(',')
        for (var i = 0; i < s.length; i++) {
            Message(s[i]);
        }
    })
    //显示房源信息
    function Message(id) {
        $.ajax({
            url: "/UserCenter/GetTableMessage",
            type: "Post",
            dataType: "Json",
            data: { id: id },
            success: function (obj) {
                obj = eval(obj);
                $("#tbo").append('<tr><td><ul><li hoseid=' + obj.House_Id + ' class="fcBlack clearfix">' +
                   '<a href="/HouseMessage/HouseMessage?House_Id=' + obj.House_Id + '"' + ' target="view_frame" class="fcBlack">' +
                   '<img class="fcBlack fl" style="width:100px; height:100px;" src=\"http://47.93.33.136:8080/userfiles/1/images/adminReleaseRoom/img/2017/08/fangjian.jpg\" alt="图片"/>' +
                   '<div>' +
                   '<p style="margin-left:50px;" class="fn-font-16 fcBlack">' + obj.House_Name + '</p>' +
                   '<p><span class="fn-font-clor-red">' + obj.House_Price + '</span>元/月</p>' +
                   '<p>可租面积 <span>' + obj.House_Area + 'm<sup>2</sup></span> &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; <span class="fn-font-12">' + obj.House_Intro + '</span></p>' +
                   '</a>' +
                   '</div>' +
                   '</li></ul></td></tr>')
            }
        })
    }
</script>

<!-- 左侧导航-->
<script>

    ParentNav();
    // 绑定根节点
    function ParentNav() {
        $.ajax({
            type: "post",
            url: "/Partner/LeftNav",
            dataType: "json",
            success: function (data) {
                var htmltab = "";
                for (var i = 0; i < data.length; i++) {
                    htmltab += "<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" style=\"width: 175px;font-size: 16px;\">" + data[i].Lar_Name + "</a>" + SonNav(data[i].Limit_Id) + "</li>";
                }
                $("#divLeft").append(htmltab);
            },
            error: function (err) {
                alert(err);
            }
        })
    }
    // 绑定子节点
    function SonNav(id) {
        var html1 = "";
        $.ajax({
            type: "post",
            url: "/Partner/LeftSon",
            data: { pid: id },
            dataType: "json",
            async: false,
            success: function (data) {
                var strhtml = "<ul class=\"dropdown-menu\">"
                for (var i = 0; i < data.length; i++) {
                    strhtml += "<li><a href=\"" + data[i].Limit_Url + "\">" + data[i].Limit_Name + "</a></li>"
                }
                strhtml += "</ul>";
                html1 = strhtml;
            }
        })
        return html1;
    }
</script>
